package com.dhx.dao;

import com.dhx.model.RuKuDetail;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * @ClassName RuKuDetailDao
 * @Author 邓皓轩
 * @Date 2024/11/3 下午5:10
 **/
public class RuKuDetailDao {
    //添加入库明细
    public boolean addRuKuDetail(RuKuDetail rukudetail, Connection conn) throws SQLException
    {
        String sql = "insert into ruku_detail(ruku_id,sp_name,price,num) values(?,?,?,?)";
        PreparedStatement preparedStatement = conn.prepareStatement(sql);
        preparedStatement.setInt(1,rukudetail.getRukuId());
        preparedStatement.setString(2,rukudetail.getSpName());
        preparedStatement.setInt(4,rukudetail.getNum());
        preparedStatement.setBigDecimal(3,rukudetail.getPrice());
        int i = preparedStatement.executeUpdate();
        if (i > 0){
            return true;
        }else{
            return false;
        }
    }
}
